import { request } from '/util/request.js'

// 活动相关的API方法
// 获取所有活动（修复参数名大小写）

const token = uni.getStorageSync('token');

export function getAllActivity(type, userId) {
  return request.get('/activity/getAllActivity', {
    type,userId
  })
};

export function selectOneById(activityId,userId) {
  return request.get('/activity/selectOne', {
	  activityId,userId
  })
};

export function selectOne(activity) {
  return request.post('/activity/selectOne', {
});
}

export function getActivityList(activity) {
  return request.post('/activity/list', activity);
};




// 添加活动
export function addActivity(activity) {
  return request.post('/activity/add', activity);
};

// 更新活动
export function updateActivity(activity) {
  return request.post('/activity/update', activity);
};

// 删除活动
export function deleteActivity(activity) {
  return request.post('/activity/delete', activity);
};

// 导出活动数据（修复 responseType）
export function exportActivity (activity) {
  // 修复：导出 Excel 应使用 'blob' 类型，而非 'json'
  return request.post('/activity/export', activity, { 
    responseType: 'blob' 
  });
};